package org.shopen.ai.puremvc.controller.algo
{
	import flash.events.Event;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.AsyncCommand;
	import org.shopen.ai.puremvc.model.algo.AlgoProxy;
	import org.shopen.ai.puremvc.model.utils.CompleteDelegate;
	import org.shopen.ai.puremvc.model.utils.ICompleteDelegate;

	public class LoadAlgorithmsCommand extends AsyncCommand
	{
		override public function execute(notification:INotification):void
		{
			var proxy : AlgoProxy = facade.retrieveProxy(AlgoProxy.NAME) as AlgoProxy;
			var delegate : ICompleteDelegate = new CompleteDelegate();
			delegate.addEventListener(CompleteDelegate.COMPLETE, completeListener);
			proxy.loadAlgorithms(delegate, notification.getType());
		}
		
		private function completeListener(event:  Event) : void
		{
			commandComplete();
		}
	}
}